﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Tracy.DataModel;
using Tracy;

namespace TracyGUI
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Only allow one instance running
            bool createNew;
            using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    //Init
                    TracyFacade.Instance.Initialize();
                    Application.Run(new FormMain());
                }
                else
                {
                    MessageBox.Show("Another instance of Tracy is already runing");
                    System.Threading.Thread.Sleep(1000);
                    System.Environment.Exit(1);
                }

            }

        }
    }
}
